Gradual Set-Theoretic Types

نویسنده

  • Victor Lanvin
چکیده

Problem and motivation. A static type system can be an extremely powerful tool for a programmer, providing early error detection, and offering strong compile-time guarantees on the behavior of a program. However, compared to dynamic typing, static typing often comes at the expense of development speed and flexibility, as statically-typed code might be more difficult to adapt to changing requirements. Gradual typing is a recent and promising approach that tries to get the best of both worlds [16]. The idea behind this approach is to integrate an unknown type, usually denoted by “?”, which informs the compiler that additional type checks may have to be performed at run time. Therefore, the programmer can gradually add type annotations to a program and controls precisely how much checking is done statically versus dynamically. Gradual typing thus allows the programmer to finely tune the distribution of dynamic and static checking over a program. However, gradualization of single expressions has more limited breadth. We argue that adding full-fledged union and intersection types to a gradual type system makes the transition between dynamic typing and static typing smoother and finer grained, giving even more control to the programmer. In particular, we are interested in developing gradual typing for the semantic subtyping approach [10], where types are interpreted as sets of values. In this approach union and intersection types are naturally interpreted as the corresponding settheoretic operations, and the subtyping relation is defined as setcontainment, whence the name of set-theoretic types. This yields an intuitive and powerful type system in which several important constructions —eg, branching, pattern-matching, and overloading— can be typed very precisely. Set-theoretic types, however, exacerbate the shortcomings of static typing. In particular, type reconstruction for intersection type systems is, in general, undecidable. The consequence is that programmers have to add complete type annotations for every variable, which may hinder their development speed; all the more so given that union and intersection type annotations can be syntactically heavy. Adding gradual typing to set-theoretic types may help to alleviate this issue by providing a way to relax the rigidity of certain type annotations via the addition of a touch of dynamic typing, while keeping the full power of static types for critical parts of code. We said that adding set-theoretic types to a gradual type system makes the transition between dynamic typing and static typing smoother. This is for example the case for function parameters that are to be bound to values of basic types: in the current setting, the only way to gradualize their type is to use “?”, while with union and intersection types more precise gradualizations become possible. We illustrate this fact in an ML-like language by progressively refining the following example that we borrow from Siek and Vachharajani [19].

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

SOME SIMILARITY MEASURES FOR PICTURE FUZZY SETS AND THEIR APPLICATIONS

In this work, we shall present some novel process to measure the similarity between picture fuzzy sets. Firstly, we adopt the concept of intuitionistic fuzzy sets, interval-valued intuitionistic fuzzy sets and picture fuzzy sets. Secondly, we develop some similarity measures between picture fuzzy sets, such as, cosine similarity measure, weighted cosine similarity measure, set-theoretic similar...

متن کامل

Algebraic Speciications, Higher-order Types, and Set-theoretic Models

In most algebraic speciication frameworks, the type system is restricted to sorts, subsorts, and rst-order function types. This is in marked contrast to the so-called model-oriented frameworks, which provide higher-order types, interpreted set-theoretically as Cartesian products , function spaces, and power-sets. This paper presents a simple framework for algebraic speciications with higher-ord...

متن کامل

The Effect of Grammar vs. Vocabulary Pre-teaching on EFL Learners’ Reading Comprehension: A Schema-Theoretic View of Reading

This study was designed to investigate the effect of grammar and vocabulary pre-teaching, as two types of pre-reading activities, on the Iranian EFL learners’ reading comprehension from a schema–theoretic perspective. The sample consisted of 90 female students studying at pre-university centers of Isfahan.  The subjects were randomly divided into three equal-in-number groups. They participated ...

متن کامل

Multi-granulation fuzzy probabilistic rough sets and their corresponding three-way decisions over two universes

This article introduces a general framework of multi-granulation fuzzy probabilistic roughsets (MG-FPRSs) models in multi-granulation fuzzy probabilistic approximation space over twouniverses. Four types of MG-FPRSs are established, by the four different conditional probabilitiesof fuzzy event. For different constraints on parameters, we obtain four kinds of each type MG-FPRSs...

متن کامل

Algebraic Specifications, Higher-Order Types, and Set-Theoretic Models

In most algebraic specification frameworks, the type system is restricted to sorts, subsorts, and first-order function types. This is in marked contrast to the so-called model-oriented frameworks, which provide higher-order types, interpreted set-theoretically as Cartesian products, function spaces, and power-sets. This paper presents a simple framework for algebraic specifications with higher-...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2017